﻿import QtQuick 2.0

Rectangle{
    width: 24
    height: 24
    Canvas {
        id: mycanvas
        anchors.fill: parent
        onPaint: {
            var ctx = getContext("2d");
            ctx.fillStyle = ma.containsMouse?"red":"white"
            ctx.fillRect(0, 0, width, height);
            ctx.lineWidth = 2;
            ctx.strokeStyle = '#ffffff';
            ctx.moveTo(0, 0);
            ctx.lineTo(width, height);
            ctx.stroke();
            ctx.strokeStyle = '#ffffff';
            ctx.moveTo(0, height);
            ctx.lineTo(width, 0);
            ctx.stroke();
        }
    }
    MouseArea{
        id:ma
        anchors.fill: parent
        hoverEnabled: true
        onEntered: {
            mycanvas.requestPaint()
        }
        onExited: {
           mycanvas.requestPaint()
        }
    }
}
